import request from "@/utils/request";

// 创建API
enum API {
  // 获取全部的商品
  SKULIST_URL = "/admin/product/list/",
  // 查看详情的页面
  SKUALLLIST_URL = "/admin/product/getSkuById/",
  // 下架的
  SKUCANCEL_URL = "/admin/product/cancelSale/",
  // 上架
  ONSALE_URL = "/admin/product/onSale/",
}

// 发送获取全部的请求
export const reqAllList = (page: number | string, limit: number | string) =>
  request.get<any, any>(API.SKULIST_URL + `${page}/${limit}`);
// 获取详情页面的查看
export const reqAllListDetail = (skuId: number | string) =>
  request.get<any, any>(API.SKUALLLIST_URL + skuId);
// 更新页面下架
export const reqCancelSale = (skuId: number | string) =>
  request.get<any, any>(API.SKUCANCEL_URL + skuId);
// 更新页面上加
export const reqSale = (skuId: number) =>
  request.get<any, any>(API.ONSALE_URL + skuId);
